cmake_minimum_required(VERSION 3.10)
project(PathPlanningLibrary)

# 设置C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 编译选项
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -O3")

# 查找OpenCV
find_package(OpenCV REQUIRED)

# 包含目录
include_directories(include)

# 源文件分组
set(CORE_SOURCES
    src/core/Map.cpp
    src/core/PlannerBase.cpp
    src/core/Visualization.cpp
    src/core/main.cpp
)

set(PLANNER_SOURCES
    src/planners/DijkstraPlanner.cpp
    src/planners/AStarPlanner.cpp
    src/planners/HybridAStarPlanner.cpp
    src/planners/ThetaStarPlanner.cpp
    src/planners/RRTStarPlanner.cpp
    src/planners/JPSPlanner.cpp
)

# 创建可执行文件
add_executable(path_planning_demo ${CORE_SOURCES} ${PLANNER_SOURCES})

# 链接库
target_link_libraries(path_planning_demo ${OpenCV_LIBS})

# 安装目标
install(TARGETS path_planning_demo DESTINATION bin)

# 安装配置文件和地图
install(DIRECTORY config/ DESTINATION config)
install(DIRECTORY maps/ DESTINATION maps)

# 测试目标
enable_testing()

# 创建构建脚本
# configure_file(
#     ${CMAKE_SOURCE_DIR}/scripts/build_and_run.sh.in
#     ${CMAKE_BINARY_DIR}/build_and_run.sh
#     @ONLY
# )